<?php

namespace RTSCraft\MainBundle\Repository;

use Doctrine\ORM\EntityRepository;

class CategoryRepository extends EntityRepository
{
  public function findByName($n)
  {
    $em = $this->getEntityManager();
    $dql = 'select c FROM RTSCraft\MainBundle\Entity\Category c
WHERE c.name = \'' . $n . '\' AND c.deleted = false';
    $query = $em->createQuery($dql);
    $query->setMaxResults(1);
    return $query->getResult();
  }
}
?>
